﻿using Infrastructure.DDD;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Application.Entities
{
    /*
     * CURD、启用、暂停、日志
     */
    [Table("job_notice")]
    public class Notice : Entity
    {
        /// <summary>
        /// 来源Id(执行日志id)
        /// </summary>
        public long SourceId { get; set; }
        [Column(TypeName = "nvarchar(24)")]
        public NoticeStatus NoticeStatus { get; set; } = NoticeStatus.Pending;
        public bool IsBusinessSuccess { get; set; }
        public string SentResult { get; set; }

        [Column(TypeName = "varchar(100)")]
        public string Title { get; set; }

        [Column(TypeName = "varchar(2000)")]
        public string Content { get; set; }

        [Column(TypeName = "nvarchar(24)")]
        public NoticeType Type { get; set; } = NoticeType.Email;
        //邮箱、手机号、接口等；频率策略已此为依据
        [Column(TypeName = "nvarchar(200)")]
        public string NoticeObject { get; set; }
        public DateTime? SentTime { get; set; }


    }
    /// <summary>
    /// 状态
    /// </summary>
    public enum NoticeStatus
    {
        [Display(Name = "待通知")]
        Pending = 0,

        [Display(Name = "已发送")]
        Sent = 1,

        [Display(Name = "未发送")]
        NotSent = 2,
    }
    /// <summary>
    /// 方式
    /// </summary>
    public enum NoticeType
    {
        [Display(Name = "邮件")]
        Email = 0,

        [Display(Name = "短信")]
        Sms = 1,

        [Display(Name = "接口")]
        Api = 2,
    }
}
